//
//  GWShopHeaderView.m
//  GiftWanted
//
//  Created by lanou on 15/11/12.
//  Copyright © 2015年 陈文杰. All rights reserved.
//

#import "GWShopHeaderView.h"
#import "UIImageView+WebCache.h"

@implementation GWShopHeaderView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        _coverImg = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 150)];
        UIView *coverView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 150)];
        coverView.backgroundColor = [UIColor blackColor];
        coverView.alpha = 0.1;
        _iconImg = [[UIImageView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH/2-25, 25, 50, 50)];
        _iconImg.backgroundColor = [UIColor whiteColor];
        _iconImg.layer.cornerRadius = 25;
        _iconImg.layer.masksToBounds = YES;
        _nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 75, SCREEN_WIDTH, 25)];
        _nameLabel.textColor = [UIColor whiteColor];
        _nameLabel.textAlignment = NSTextAlignmentCenter;
        _nameLabel.font = [UIFont fontWithName:@"Trebuchet-BoldItalic" size:15];
        _descLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 100, SCREEN_WIDTH, 25)];
        _descLabel.textColor = [UIColor whiteColor];
        _descLabel.textAlignment = NSTextAlignmentCenter;
        _descLabel.font = [UIFont fontWithName:@"Trebuchet-BoldItalic" size:12];
        [self addSubview:_coverImg];
        [self addSubview:coverView];
        [self addSubview:_iconImg];
        [self addSubview:_nameLabel];
        [self addSubview:_descLabel];
    }
    return self;
}

- (void)setConfigureModel:(GWShopDetailModel *)configureModel {
    _configureModel = configureModel;
    [_coverImg sd_setImageWithURL:[NSURL URLWithString:configureModel.cover_image_url]];
    [_iconImg sd_setImageWithURL:[NSURL URLWithString:configureModel.icon_url]];
    _nameLabel.text = configureModel.name;
    _descLabel.text = configureModel.desc;
}

@end
